<template>
	<view class="content">
		<view class="box">
			<view class="temple">
				<view v-if="list.length==0" class="empty-box">
					<u-empty mode="list"></u-empty>
				</view>
				<view class="temple-item" v-for="item in list" @click="itemClick(item)">
					<view class="temple-item-left">
						<view class="temple-title">
							{{ item.title }}
						</view>
						<view class="temple-position">
							<view class="img">
								<text class="icon-position iconfont" style="font-size: 36rpx;"></text>
							</view>
							<view class="text">
								{{ item.title }}
							</view>
						</view>
					</view>
					<view class="temple-item-right">
						<u-image width="40rpx" height="40rpx" src="/static/img/temple_details.png"></u-image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				logo_title:'',
				avatar:'',
				settingData:{}
			};
		},
		onLoad() {
			this.getList()
			let settingData = uni.getStorageSync('settingData')
			this.settingData = settingData
			this.logo_title = settingData.value.logo_title
			this.avatar = settingData.image
		},
		methods:{
			getList(){
				this.$api.getProject().then(res=>{
					this.list= res.data.list
				})
			},
			itemClick(item){
				if(item.url){
					uni.showModal({
					    title: '提示',
					    content: '请确认是否打开微信，并分享链接：‌',
					    success: (res)=> {
					        if (res.confirm) {
								console.log(this.settingData,item)
								uni.share({
									provider: "weixin",
									scene: "WXSceneTimeline",
									type: 0,
									href: item.url,
									title: item.title,
									summary: this.logo_title,
									imageUrl: this.avatar,
									success: function (res) {
										console.log("success:" + JSON.stringify(res));
									},
									fail: function (err) {
										console.log("fail:" + JSON.stringify(err));
									}
								});
					        }
					    }
					});
				}else{
					uni.showModal({
						title:'温馨提示',
						content:"项目研发中，敬请期待",
						showCancel:false,
					})
				}
			}
		}
	}
</script>

<style lang="scss">
.content {
		background: url('@/static/img/bg.png');
		min-height: 100vh;
		z-index: -1;
		.box{
			padding: 30rpx;
			.temple{
				.temple-item{
					background: #FEF1DC;
					border-radius: 20rpx;
					padding: 36rpx 30rpx 28rpx 30rpx;
					display: flex;
					justify-content: space-between;
					margin-bottom: 16rpx;
					.temple-item-left{
						.temple-title{
							font-family: PingFangSC, PingFang SC;
							font-weight: 600;
							font-size: 36rpx;
							color: #111111;
							line-height: 42rpx;
							text-align: left;
							font-style: normal;
						}
						.temple-position{
							display: flex;
							padding-top: 10rpx;
							.text{
								font-family: PingFangSC, PingFang SC;
								font-weight: 400;
								font-size: 28rpx;
								color: #AAAAAA;
								line-height: 50rpx;
								text-align: left;
								font-style: normal;
							}
							.img{
								width: 32rpx;
								height: 32rpx;
							}
						}
					}
					.temple-item-right{
						padding-top: 24rpx;
					}
				}
			}
		}
	}
</style>
